<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>鑫泽科智能印章管理平台</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="css/layui.css">
</head>
<body>

<div class="layui-layout layui-layout-admin">
   <!--顶部固定区域-->
  <div class="layui-header">
    <div class="layui-logo layui-hide-xs layui-bg-black">鑫泽科智能印章管理平台</div>
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item layui-hide layui-show-md-inline-block">
        <a href="javascript:;">
          <img src="images/avatar.png" class="layui-nav-img">
          <span id="userName">请登录</span>
        </a>
        <dl class="layui-nav-child">
          <dd lay-on="account"><a href="javascript:;">个人资料</a></dd>
          <dd><a href="login.html">退出登录</a></dd>
        </dl>
      </li>
    </ul>
  </div>

  <!-- 左侧菜单 -->
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <ul id="menu" class="layui-nav layui-nav-tree" lay-filter="menu">
        <li class="layui-nav-item layui-this" lay-on="onSelectMenu" data-name="数据看板" data-url="dashboard.html">
            <a href="javascript:;">数据看板</a>
        </li>

        <li class="layui-nav-item layui-nav-itemed" style="display:none;" id="menu2">
          <a href="javascript:;">公司管理</a>
          <dl class="layui-nav-child">
            <dd lay-on="onSelectMenu" data-name="企业列表" data-url="company.html" style="display:none;" id="menu3"><a href="javascript:;">企业列表</a></dd>
            <dd lay-on="onSelectMenu" data-name="企业用户" data-url="register-user.html" style="display:none;" id="menu4"><a href="javascript:;">企业用户</a></dd>
            <dd lay-on="onSelectMenu" data-name="绑定印章" data-url="seal.html" style="display:none;" id="menu5"><a href="javascript:;">绑定印章</a></dd>
          </dl>
        </li>

        <li class="layui-nav-item layui-nav-itemed" style="display:none;" id="menu6">
          <a href="javascript:;">充值管理</a>
          <dl class="layui-nav-child">
            <dd lay-on="onSelectMenu" data-name="套餐包" data-url="set-meal.html" style="display:none;" id="menu7"><a href="javascript:;">套餐包</a></dd>
            <dd lay-on="onSelectMenu" data-name="充值记录" data-url="recharge-record.html" style="display:none;" id="menu8"><a href="javascript:;">充值记录</a></dd>
          </dl>
        </li>

        <li class="layui-nav-item layui-nav-itemed" style="display:none;" id="menu9">
            <a href="javascript:;">系统管理</a>
            <dl class="layui-nav-child">
              <dd lay-on="onSelectMenu" data-name="角色管理" data-url="role-manager.html" style="display:none;" id="menu10"><a href="javascript:;">角色管理</a></dd>
              <dd lay-on="onSelectMenu" data-name="人员管理" data-url="user-manager.html" style="display:none;" id="menu11"><a href="javascript:;">人员管理</a></dd>
              <dd lay-on="onSelectMenu" data-name="服务器状态" data-url="server-status.html" style="display:none;" id="menu12"><a href="javascript:;">服务器状态</a></dd>
              <dd lay-on="onSelectMenu" data-name="系统日志" data-url="system-log.html" style="display:none;" id="menu13"><a href="javascript:;">系统日志</a></dd>
            </dl>
          </li>
      </ul>
    </div>
  </div>
  
  <!-- 右侧容器 -->
  <div class="layui-body">
    <blockquote class="layui-elem-quote layui-text" style="margin-bottom:0px;" id="navText">
        数据看板
    </blockquote>
    <iframe src="dashboard.html" id="pageContainer" style="width:100%;height:100%;" frameborder="0"></iframe>
  </div>
  
   <!-- 底部固定区域 -->
  <div class="layui-footer">
    Copyright © 2020-<span id="year">2023</span> Senzke All rights reserved
  </div>
</div>

<script src="js/layui.js"></script>
<script type="module">
    import indexClient from './js/index.js'
    import roleManager from './js/role-manager.js'
    
    layui.use(['layer','util'], function(){
        var token = sessionStorage.getItem("token");
        if(!!!token){
            window.location.replace('login.html')
        }
        
        var layer = layui.layer,
        util = layui.util,
        $=layui.$;
        
        var now = new Date();
        var year = now.getFullYear();
        $("#year").html(year)

        var userData = JSON.parse(sessionStorage.getItem("userData"));
        $('#userName').text(userData.displayName);
        
        // 获取菜单权限
        roleManager.getRoleRightIds($,userData.systemRoleId,function(rspData){
          // $('#system').toggle();
          $.each(rspData.data,function(idx,menuId){
            $('#menu' + menuId).toggle();
          })
        });

        util.on('lay-on',{
            account:function(){
                layer.open({
                    type: 2
                    ,title:'个人资料'
                    ,content: 'account-info.html'
                    ,area: ['450px', '500px']
                    ,maxmin: false,
                });
            },
            onSelectMenu:function(){
                $('#navText').html($(this).attr("data-name"));
                $('#pageContainer').attr('src',$(this).attr("data-url"));
            }
        })
    });
</script>
</body>
</html>
